function printnum() {
    let m = prompt('请输入第一个数：');
    let n = prompt('请输入第二个数：');
    let flag = fn(m, n);
    if (flag) {
        printnum();
        return;
    }
    let result;
    m = parseInt(m);
    n = parseInt(n);
    if (m < n) {
        result = n - m;
    }
    else {
        result = m - n;
    }
    document.write('两数差为：' + result);
}
printnum();

function fn(i, j) {
    if (isNaN(i) || isNaN(j)) {
        alert('请输入数字');
        return true;
    }
    return false;
}
